<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 给全局对象 window 对象，动态添加了一个属性
        var a = 1;
        console.log(window.a);

        // 写法2 
        window.b = 2
        // 可以省略
        b = 2;
        console.log(window.b);

        delete window.a;
        // 删除失败： why？
        console.log(window.a);


        // 获取对象的属性描述符
        console.log(Object.getOwnPropertyDescriptor(window, 'a'));
        /* 
        configurable : false   (允许删除/编辑)
        enumerable : true      (可枚举)(for-in)
        value : 1              (值)
        writable  :  true      (可写)
        */
    </script>
</body>

</html>